// pages/community/community.js
const app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getData();
  },
  getData:function(){
    let self = this
    wx.request({
      url: `${app.globalData.url}/community/cat`, 
      // data: {
      // },
      method:'GET',
      header: {
        'content-type': 'application/json' 
      },
      success: function (res) {
        console.log(res.data)
        let result = res.data;
        if (result.length>0){
          self.setData({
            petsData:result
          })
        }
      }
    })
  },
  onShow: function () {
    this.getData()
  },

  //跳转到商品详情页
  jumpDetail: function (e) {
   let petsnum =e.currentTarget.id;
   console.log(petsnum)
    wx.navigateTo({
      url:"/pages/com_detail/com_detail?Wid= "+ petsnum
    })
  },

})